﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@model MockSchoolManagement.Mvc.ViewModel.EditRoleViewModel
@{
    ViewBag.Title = "角色编辑";
}
<h1>编辑角色</h1>
<form method="post" class="mt-3">
    <div class="form-group row">
        <label asp-for="Id" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input class="form-control" asp-for="Id" disabled="disabled" />
        </div>
    </div>
    <div class="form-group row">
        <label asp-for="RoleName" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="RoleName" class="form-control"/>
            <span asp-validation-for="RoleName" class="text-danger"></span>
        </div>
    </div>
    <div asp-validation-summary="All" class="text-danger"></div>
    
    <div class="form-group row">
        <div class="col-sm-10">
            <button type="submit" class="btn btn-primary">更新</button>
            <a asp-action="ListRole" class="btn btn-primary">取消</a>
        </div>
    </div>
    <div class="card">
        <div class="card-header">
            <h3>该角色中的用户</h3>
        </div>
        <div class="card-body">
            @if (Model.User.Any())
            {
                @foreach (var user in Model.User)
                {
                    <h5 class="card-title">@user</h5>
                }
            }
            else
            {
                <h5 class="card-title">目前没有信息</h5>
            }
        </div>
        <div class="card-footer">
            <a asp-controller="Admin" asp-action="EditUserInRole" asp-route-roleId="@Model.Id" class="btn btn-primary">从角色中添加或删除用户</a>
        </div>
    </div>
</form>
